package com.szb;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author leng
 * @Description TODO
 * @date 2021/7/22 15:20
 */
@RestController
@RefreshScope
public class ApiController {

    // 配置多态刷新
    @Autowired
    private ConfigurableApplicationContext applicationContext;


//    @Value("${param}")
//    private String param;

    @GetMapping("api-get")
    public String patch(){
        String param = applicationContext.getEnvironment().getProperty("param");
        return param;
    }
}
